package main

import "fmt"

/**
https://leetcode-cn.com/problems/find-center-of-star-graph/

中心节点与所有的其余节点相连

则必然出现在每一个数组对中

则找出一个数字在第0和第1个都出现的就行

*/
func findCenter(edges [][]int) int {
	a, b := edges[0][0], edges[0][1]
	if a == edges[1][0] || a == edges[1][1] {
		return a
	}
	return b
}

func main() {
	fmt.Println(findCenter([][]int{{1, 2}, {2, 3}, {4, 2}}))
	fmt.Println(findCenter([][]int{{1, 2}, {5, 1}, {1, 3}, {1, 4}}))
}
